package com.jvxb.manage.livable.service.dbDeploy;

import com.jvxb.manage.livable.entity.AssetsAgentHost;
import com.jvxb.manage.livable.entity.DbDeployInfo;
import com.jvxb.manage.livable.entity.DbDeployInstance;
import com.jvxb.manage.livable.vo.ClusterApplyVo;
import com.jvxb.manage.livable.vo.WorkOrderOperateVo;

import java.util.List;

/**
 * 通用DB部署Service，具体部署逻辑在子类实现中
 * @author jvxb
 * @since 2022-01-10
 */
public interface BaseDeployService {

    /**
     * 检查资源是否足够
     */
    List<AssetsAgentHost> checkAndGetResource(DbDeployInfo dbDeployInfo, boolean getResource);

    /**
     * 保存db申请信息
     */
    void saveApply(ClusterApplyVo order);

    /**
     * 根据db申请信息选择资源进行部署
     */
    List<DbDeployInstance> getDbDeployInstances(DbDeployInfo dbDeployInfo);

    /**
     * 部署db
     */
    void deploy(DbDeployInfo dbDeployInfo, WorkOrderOperateVo workOrderOperateVo);

    /**
     * 部署db成功的处理
     */
    void deploySuccess(DbDeployInfo dbDeployInfo, WorkOrderOperateVo workOrderOperateVo);

    /**
     * 部署db失败的处理
     */
    void deployFail(DbDeployInfo dbDeployInfo, String errMsg);

}
